<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="笼位名称" prop="cageName">
        <el-input
          v-model="queryParams.cageName"
          placeholder="请输入笼位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="笼架类型" prop="cageRack">
        <el-select v-model="queryParams.cageRack" placeholder="请选择笼架类型" clearable>
          <el-option
            v-for="dict in dict.type.cage_rack"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="笼架名称" prop="rackName">
        <el-input
          v-model="queryParams.rackName"
          placeholder="请输入笼架名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="笼位动物" prop="animalId">
        <el-select v-model="queryParams.animalId" placeholder="请选择笼位动物" clearable>
          <el-option
            v-for="item in animalOptions"
            :key="item.animalId"
            :label="item.animalName"
            :value="item.animalId"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="在笼数量" prop="animalNum">
        <el-input
          v-model="queryParams.animalNum"
          placeholder="请输入在笼数量"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最大容量" prop="cageMaxNum">
        <el-input
          v-model="queryParams.cageMaxNum"
          placeholder="请输入最大容量"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所属人员" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="请输入所属人员"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所属实验" prop="exName">
        <el-input
          v-model="queryParams.exName"
          placeholder="请输入所属实验"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所属课题" prop="topicName">
        <el-input
          v-model="queryParams.topicName"
          placeholder="请输入所属课题"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="笼位类型" prop="cageType">
        <el-select v-model="queryParams.cageType" placeholder="请选择笼位类型" clearable>
          <el-option
            v-for="dict in dict.type.cage_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
<!--      <el-form-item label="笼位位置" prop="position">-->
<!--        <el-select v-model="queryParams.position" placeholder="请选择笼位位置" clearable>-->
<!--          <el-option-->
<!--            v-for="dict in dict.type.cage_type"-->
<!--            :key="dict.value"-->
<!--            :label="dict.label"-->
<!--            :value="dict.value"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
      <el-form-item label="安全等级" prop="safetyLevel">
        <el-select v-model="queryParams.safetyLevel" placeholder="请选择安全等级" clearable>
          <el-option
            v-for="dict in dict.type.safety_level"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="环境等级" prop="envLevel">
        <el-select v-model="queryParams.envLevel" placeholder="请选择环境等级" clearable>
          <el-option
            v-for="dict in dict.type.env_level"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="笼位状态" prop="cageStatus">
        <el-select v-model="queryParams.cageStatus" placeholder="请选择笼位状态" clearable>
          <el-option
            v-for="dict in dict.type.cage_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['animalManagement:cage:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['animalManagement:cage:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['animalManagement:cage:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['animalManagement:cage:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="cageList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="笼位名称" align="center" prop="cageName" />
      <el-table-column label="笼架类型" align="center" prop="cageRack">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.cage_rack" :value="scope.row.cageRack"/>
        </template>
      </el-table-column>
      <el-table-column label="笼架名称" align="center" prop="rackName" />
      <el-table-column label="笼位动物" align="center" prop="animalId" >
        <template slot-scope="scope">
          {{ getAnimalName(scope.row.animalId) }}
        </template>
      </el-table-column>
      <el-table-column label="在笼数量" align="center" prop="animalNum" />
      <el-table-column label="最大容量" align="center" prop="cageMaxNum" />
      <el-table-column label="所属人员" align="center" prop="userName" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_user" :value="scope.row.cageType"/>
        </template>
      </el-table-column>
      <el-table-column label="所属实验" align="center" prop="exName" />
      <el-table-column label="所属课题" align="center" prop="topicName" />
      <el-table-column label="笼位类型" align="center" prop="cageType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.cage_type" :value="scope.row.cageType"/>
        </template>
      </el-table-column>
      <el-table-column label="笼位位置" align="center" width="120">
        <template slot-scope="scope">
          <el-popover trigger="click" placement="top-start" width="560" :content="fullPosition(scope.row)">
            <el-button slot="reference" type="text" size="mini">位置信息</el-button>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column label="安全等级" align="center" prop="safetyLevel">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.safety_level" :value="scope.row.safetyLevel"/>
        </template>
      </el-table-column>
      <el-table-column label="环境等级" align="center" prop="envLevel">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.env_level" :value="scope.row.envLevel"/>
        </template>
      </el-table-column>
      <el-table-column label="笼位状态" align="center" prop="cageStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.cage_status" :value="scope.row.cageStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['animalManagement:cage:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['animalManagement:cage:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改笼位管理对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="160px">
        <el-row>

        <el-col :span="12">
            <el-form-item label="笼位名称" prop="cageName">
              <el-input v-model="form.cageName" placeholder="请输入笼位名称" />
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="笼架类型" prop="cageRack">
              <el-select v-model="form.cageRack" placeholder="请选择笼架类型">
                <el-option
                  v-for="dict in dict.type.cage_rack"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="笼架名称" prop="rackName">
              <el-input v-model="form.rackName" placeholder="请输入笼架名称" />
            </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="笼位动物" prop="cageId">
            <el-select v-model="form.animalId" placeholder="请选择笼位动物">
              <el-option
                v-for="item in animalOptions"
                :key="item.animalId"
                :label="item.animalName"
                :value="item.animalId"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="在笼数量" prop="animalNum">
              <el-input v-model="form.animalNum" placeholder="请输入在笼数量" />
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="最大容量" prop="cageMaxNum">
              <el-input v-model="form.cageMaxNum" placeholder="请输入最大容量" />
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="所属人员" prop="userName">
              <el-select v-model="form.userName" placeholder="请选择人员">
                <el-option
                  v-for="dict in dict.type.sys_user"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="所属实验" prop="exName">
              <el-input v-model="form.exName" placeholder="请输入所属实验" />
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="所属课题" prop="topicName">
              <el-input v-model="form.topicName" placeholder="请输入所属课题" />
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="笼位类型" prop="cageType">
              <el-select v-model="form.cageType" placeholder="请选择笼位类型">
                <el-option
                  v-for="dict in dict.type.cage_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
        </el-col>
          <el-col :span="12">
            <el-form-item label="笼位位置" prop="buildingId">
              <el-input :value="buildingDisplay" placeholder="请选择楼栋" readonly>
                <el-button slot="append" @click="openBuildingDialog">选择</el-button>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="位置拼接预览">
              <div>{{ positionPreview() }}</div>
            </el-form-item>
          </el-col>
<!--        <el-col :span="12">-->
<!--            <el-form-item label="笼位位置" prop="position">-->
<!--              <el-select v-model="form.position" placeholder="请选择笼位位置">-->
<!--                <el-option-->
<!--                  v-for="dict in dict.type.cage_type"-->
<!--                  :key="dict.value"-->
<!--                  :label="dict.label"-->
<!--                  :value="dict.value"-->
<!--                ></el-option>-->
<!--              </el-select>-->
<!--            </el-form-item>-->
<!--        </el-col>-->
        <el-col :span="12">
            <el-form-item label="安全等级" prop="safetyLevel">
              <el-select v-model="form.safetyLevel" placeholder="请选择安全等级">
                <el-option
                  v-for="dict in dict.type.safety_level"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="环境等级" prop="envLevel">
              <el-select v-model="form.envLevel" placeholder="请选择环境等级">
                <el-option
                  v-for="dict in dict.type.env_level"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item label="笼位状态" prop="cageStatus">
              <el-select v-model="form.cageStatus" placeholder="请选择笼位状态">
                <el-option
                  v-for="dict in dict.type.cage_status"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
        </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 楼栋选择弹窗 -->
    <el-dialog title="选择楼栋" :visible.sync="buildingDialogVisible" width="800px" append-to-body>
      <el-form :inline="true" :model="buildingQuery" label-width="80px">
        <el-form-item label="所属区域">
          <el-select v-model="buildingQuery.region" placeholder="请选择所属区域" clearable>
            <el-option
              v-for="dict in dict.type.building_region"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="楼栋名称">
           <el-select v-model="buildingQuery.buildingName" placeholder="请选择楼栋名称" clearable>
             <el-option
               v-for="dict in dict.type.building_name"
               :key="dict.value"
               :label="dict.label"
               :value="dict.value"
             />
           </el-select>
         </el-form-item>
        <el-form-item label="楼层号">
          <el-input v-model="buildingQuery.floors" placeholder="楼层号" size="small" />
        </el-form-item>
        <el-form-item label="房间号">
          <el-input v-model="buildingQuery.roomNo" placeholder="房间号" size="small" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="small" @click="handleBuildingQuery">搜索</el-button>
          <el-button size="small" @click="resetBuildingQuery">重置</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="buildingLoading" :data="buildingList" height="360px">
        <el-table-column label="楼栋名称" prop="buildingName" align="center">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.building_name" :value="scope.row.buildingName"/>
          </template>
        </el-table-column>
        <el-table-column label="所属区域" prop="region" align="center">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.building_region" :value="scope.row.region"/>
          </template>
        </el-table-column>
        <el-table-column label="楼层号" prop="floors" align="center" />
        <el-table-column label="房间号" prop="roomNo" align="center" />
        <el-table-column label="操作" width="120" align="center">
          <template slot-scope="scope">
            <el-button type="text" size="mini" @click="handleBuildingChoose(scope.row)">选择</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="buildingTotal>0"
        :total="buildingTotal"
        :page.sync="buildingQuery.pageNum"
        :limit.sync="buildingQuery.pageSize"
        @pagination="getBuildingList"
      />
      <div slot="footer" class="dialog-footer">
        <el-button @click="buildingDialogVisible = false">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {listCage, getCage, delCage, addCage, updateCage, getUser} from "@/api/animalManagement/cage";
import {listBuilding} from "@/api/animalManagement/building";
import { listAnimal } from "@/api/animalManagement/animal";
import { selectDictLabel } from "@/utils/ruoyi";

export default {
  name: "Cage",
  dicts: ['cage_status', 'cage_type', 'safety_level', 'env_level', 'cage_rack','sys_user', 'building_name', 'building_region'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 笼位管理表格数据
      cageList: [],
      // 动物下拉
      animalOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cageName: null,
        cageRack: null,
        rackName: null,
        animalId: null,
        animalNum: null,
        cageMaxNum: null,
        userName: null,
        exId: null,
        exName: null,
        topicId: null,
        topicName: null,
        cageType: null,
        position: null,
        safetyLevel: null,
        envLevel: null,
        cageStatus: null,
      },
      // 表单参数
      form: {},
      // 楼栋下拉
      buildingOptions: [],
      // 楼栋选择弹窗相关
      buildingDialogVisible: false,
      buildingLoading: false,
      buildingList: [],
      buildingTotal: 0,
      buildingQuery: { pageNum: 1, pageSize: 10, region: null, buildingName: null, floors: null, roomNo: null },
      // 表单校验
      rules: {
        cageName: [
          { required: true, message: "笼位名称不能为空", trigger: "blur" }
        ],
        cageRack: [
          { required: true, message: "笼架类型不能为空", trigger: "change" }
        ],
        rackName: [
          { required: true, message: "笼架名称不能为空", trigger: "blur" }
        ],
        cageType: [
          { required: true, message: "笼位类型不能为空", trigger: "change" }
        ],
        buildingId: [
          { required: true, message: "笼位位置(楼栋)不能为空", trigger: "change" }
        ],
        cageStatus: [
          { required: true, message: "笼位状态不能为空", trigger: "change" }
        ],
      }
    };
  },
  computed: {
    buildingDisplay() {
      const b = (this.buildingOptions.find(it => it.buildingId === this.form.buildingId) || {});
      const region = b.region ? selectDictLabel(this.dict.type.building_region, b.region) : '-';
      const buildingName = b.buildingName ? selectDictLabel(this.dict.type.building_name, b.buildingName) : '-';
      const floors = b.floors || '-';
      const roomNo = b.roomNo || '-';
      return `${region} / ${buildingName} / ${floors} / ${roomNo}`;
    }
  },
  created() {
    this.loadBuildings();
    this.loadAnimal();
    this.getList();
  },
  methods: {
    // 加载动物下拉选项
    loadAnimal() {
      const query = { pageNum: 1, pageSize: 1000 };
      listAnimal(query).then(res => {
        this.animalOptions = (res.rows || []).map(item => ({
          animalId: item.animalId,
          animalName: item.animalName
        }));
        console.log('动物数据加载完成:', this.animalOptions);
      }).catch(err => {
        console.error('加载动物数据失败:', err);
      });
    },
    // 根据animalId获取animalName
    getAnimalName(animalId) {
      if (!animalId) return '-';
      const animal = this.animalOptions.find(item =>
        item.animalId == animalId || item.animalId === animalId
      );
      return animal ? animal.animalName : animalId;
    },
    dictLabel(type, value) {
      return value ? selectDictLabel(this.dict.type[type], value) : '-';
    },
    fullPosition(row) {
      const region = this.dictLabel('building_region', row.region);
      const buildingName = this.dictLabel('building_name', row.buildingName);
      const floors = row.floors || '-';
      const roomNo = row.roomNo || '-';
      const rackName = row.rackName || '-';
      const cageName = row.cageName || '-';
      return `[ 所属区域：${region} 楼栋名称：${buildingName} 楼层号:${floors} 房间号:${roomNo} 笼架名称：${rackName} 笼位名称:${cageName} ]`;
    },
    // 加载楼栋列表
    loadBuildings() {
      const query = { pageNum: 1, pageSize: 1000 };
      listBuilding(query).then(res => {
        this.buildingOptions = res.rows || [];
      });
    },
    openBuildingDialog() {
      this.buildingDialogVisible = true;
      this.getBuildingList();
    },
    getBuildingList() {
      this.buildingLoading = true;
      listBuilding(this.buildingQuery).then(res => {
        this.buildingList = res.rows || [];
        this.buildingTotal = res.total || 0;
        this.buildingLoading = false;
      }).catch(() => { this.buildingLoading = false; });
    },
    handleBuildingQuery() {
      this.buildingQuery.pageNum = 1;
      this.getBuildingList();
    },
    resetBuildingQuery() {
      this.buildingQuery = { pageNum: 1, pageSize: 10, region: null, buildingName: null, floors: null, roomNo: null };
      this.getBuildingList();
    },
    handleBuildingChoose(row) {
      this.form.buildingId = row.buildingId;
      this.buildingDialogVisible = false;
    },
    /** 查询笼位管理列表 */
    getList() {
      this.loading = true;
      listCage(this.queryParams).then(response => {
        this.cageList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },

    // 表单重置
    reset() {
      this.form = {
        cageId: null,
        cageName: null,
        cageRack: null,
        rackName: null,
        buildingId: null,
        animalId: null,
        animalNum: null,
        cageMaxNum: null,
        userId: null,
        userName: null,
        exId: null,
        exName: null,
        topicId: null,
        topicName: null,
        cageType: null,
        position: null,
        safetyLevel: null,
        envLevel: null,
        cageStatusCode: null,
        cageStatus: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    // 位置拼接预览
    positionPreview() {
      const b = (this.buildingOptions.find(it => it.buildingId === this.form.buildingId) || {});
      const region = b.region ? selectDictLabel(this.dict.type.building_region, b.region) : '-';
      const buildingName = b.buildingName ? selectDictLabel(this.dict.type.building_name, b.buildingName) : '-';
      const floors = b.floors || '-';
      const roomNo = b.roomNo || '-';
      const rackName = this.form.rackName || '-';
      const cageName = this.form.cageName || '-';
      return `[ 所属区域：${region} 楼栋名称：${buildingName} 楼层号:${floors} 房间号:${roomNo} 笼架名称：${rackName} 笼位名称:${cageName} ]`;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.cageId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加笼位管理";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const cageId = row.cageId || this.ids
      getCage(cageId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改笼位管理";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.cageId != null) {
            updateCage(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addCage(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const cageIds = row.cageId || this.ids;
      this.$modal.confirm('是否确认删除笼位管理编号为"' + cageIds + '"的数据项？').then(function() {
        return delCage(cageIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('animalManagement/cage/export', {
        ...this.queryParams
      }, `cage_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
